﻿Public Class CPUusageControl
    'Dim PC As New PerformanceCounter()

    Protected Friend total As Integer
    Dim CPU As Integer
    Dim RAMVistaAnd7 As Integer
    Dim RAMXP As Integer
    Dim Core1 As Integer
    Dim Core2 As Integer
    Dim Core3 As Integer
    Dim Core4 As Integer
    Dim Core5 As Integer
    Dim Core6 As Integer
    Dim Core7 As Integer
    Dim Core8 As Integer

    Private Sub CPUusage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Text = "CPU Monitor"
        'MaximizeBox = False
        CPUBar.Minimum = 0
        CPUBar.Maximum = 100
        GrabSetup.Enabled = True
        GrabValue.Enabled = True
    End Sub

    Private Sub GrabValue_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GrabValue.Tick
        'CPU
        CPU = PerformanceCounter1.NextValue
        'Core1 = PerformanceCounterCPUCore1.NextValue
        ' Core2 = PerformanceCounterCPUCore2.NextValue
        'Core3 = PerformanceCounterCPUCore3.NextValue
        'Core4 = PerformanceCounterCPUCore4.NextValue
    End Sub

    Private Sub GrabSetup_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GrabSetup.Tick

     

        'CPU setup
        If CPUBar.Value < CPU Then
            CPUBar.Value += 1
        ElseIf CPUBar.Value > CPU Then
            CPUBar.Value -= 1
        End If
        CPUtotalPercent.Text = CPUBar.Value.ToString + "%"
        total = CPUBar.Value

        'Core2
       

        'Red Lining Setup
        'CPU
        If CPUBar.Value >= 65 Then
            CPUtotalPercent.ForeColor = Color.Red
        Else
            CPUtotalPercent.ForeColor = Color.Black
        End If


    End Sub

   
End Class
